<?php
/**
 * 
 * @author Administrator
 *
 */

class ModSpecialServicer extends Model {

    protected $table = 'special_servicer';

    // 表名
    public function tableName(){
        return $this->table;
    }

    public static function model($className=__CLASS__){
        return parent::model($className);
    }

    public function getDbConnection(){
        return Yii::app()->dbOss;
    }
    
    /**
     * 获取专服id,专服名称、渠道id，得以获取服务器所对应的专服名
     * @return unknown
     */
    public function getSpecialServer(){
    	$sql = 'SELECT sc.special_id,sc.server_id,ss.name,ss.cname,ss.status,ss.special_id as special_flag_id FROM special_servicer as sc INNER JOIN special_server as ss on ss.id = sc.special_id;';
    	$result = $this->getDbConnection()->getAll($sql, $args);
    	return $result;
    }
    
    /**
     * 根据专服id获取该专服下的服务器
     */
    public function serverForSpecialId($special_id){
    	$sql = "SELECT ss.special_id,s.id,s.server_name from special_servicer as ss INNER JOIN server as s on s.id = ss.server_id WHERE ss.special_id = {$special_id};";
    	$result = $this->getDbConnection()->getAll($sql, $args);
    	return $result;
    }

    
} 